package com.btpj.hospital_server.service;

import com.btpj.hospital_server.entity.LogAccountLogin;
import com.btpj.hospital_server.entity.LogOperation;
import com.btpj.hospital_server.mapper.LogOperationMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 登录日志Service
 *
 * @author BTPJ  2020/8/28
 */
@Service
public class LogOperationService {

    @Resource
    LogOperationMapper logOperationMapper;

    /**
     * 获取操作日志列表
     *
     * @param accountName 账号名称（模糊匹配）
     * @param method      请求方式（get/post/put/delete）
     * @return 获取操作日志列表
     */
    public List<LogOperation> getList(String accountName, String method) {
        return logOperationMapper.selectListByAccountNameOrMethod(accountName, method);
    }

    /**
     * 添加操作日志
     *
     * @param logOperation LogOperation
     */
    public void addOperationLog(LogOperation logOperation) {
        logOperationMapper.insertSelective(logOperation);
    }
}
